import Vue from 'vue'
import Router from 'vue-router'
import Index from './pages/index'
import Product from './pages/product'
import Detail from './pages/detail'
import Login from './pages/login'
import PasswordBack from './pages/passwordBack'
import PasswordChanged from './pages/passwordChanged'
import UploadSkill from './pages/uploadSkill'
import UploadBook from './pages/uploadBook'
import User from './pages/user'
import UserInfo from './pages/userinfo'
import Released from './pages/released'
import Sold from './pages/sold'
import Bought from './pages/bought'
import Collected from './pages/collected'
import Removed from './pages/removed'
import Comment from './pages/comment'
import Cart from './pages/cart'
import Order from './pages/order'
import Home from './pages/home'
import OrderConfirm from './pages/orderConfirm'
import OrderList from './pages/orderList'
import OrderPay from './pages/orderPay'
import AliPay from './pages/alipay'
import Register from './pages/register'
import Forum from './pages/forum'
// import VueRouter from 'vue-router'

Vue.use(Router);


export default new Router({
    // mode: 'hash',
    // base: process.env.BASE_URL,
    routes:[
        {
            path:'/',
            name:'home',
            component:Home,
            redirect:'/index',
            children:[
                {
                    path: '/index',
                    name: 'index',
                    component: Index,
                },
                {
                    path: '/product/:id',
                    name: 'product',
                    component: Product,
                },
                {
                    path:'/forum',
                    name:'forum',
                    component:Forum
                },
                {
                    path: '/detail/:id',
                    name: 'detail',
                    component: Detail,
                }
            ]
        },
        {
            path:'/login',
            name:'login',
            component:Login,
        },
        {
            path: '/passwordback',
            name: 'passwordback',
            component: PasswordBack
        },
        {
            path: '/passwordchanged',
            name: 'passwordchanged',
            component: PasswordChanged
        },
        {
            path: '/uploadskill',
            name: 'uploadskill',
            component: UploadSkill
        },
        {
            path: '/user',
            name: 'user',
            component: User,
            children:[
                {
                    path: 'userinfo',
                    name: 'userinfo',
                    component: UserInfo
                },
                {
                    path: 'released',
                    name: 'released',
                    component: Released
                },
                {
                    path: 'sold',
                    name: 'sold',
                    component: Sold
                },
                {
                    path: 'bought',
                    name: 'bought',
                    component: Bought
                },
                {
                    path: 'collected',
                    name: 'collected',
                    component: Collected
                },
                {
                    path: 'removed',
                    name: 'removed',
                    component: Removed
                },
                {
                    path: 'comment',
                    name: 'comment',
                    component: Comment
                }
            ]
        },
        {
            path: '/uploadbook',
            name: 'uploadbook',
            component: UploadBook
        },
        {
            path:'/register',
            name:'register',
            component:Register
        },
        {
            path:'/cart',
            name:'cart',
            component:Cart
        },{
            path:'/order',
            name:'order',
            component:Order,
            children:[
                {
                    path: 'list',
                    name: 'order-list',
                    component: OrderList,
                },
                {
                    path: 'confirm',
                    name: 'order-confirm',
                    component: OrderConfirm,
                },
                {
                    path: 'pay',
                    name: 'order-pay',
                    component: OrderPay,
                },
                {
                    path: 'alipay',
                    name: 'alipay',
                    component: AliPay,
                }
            ]
        }
    ]
});

